<?php

Raise::load('control.form.RaiseTextField');

/**
 * TestControlRaiseTextField class
 * Testing unit of 'phpraise/control/RaiseTextField.php'
 *
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestControlRaiseTextField extends RaiseTest {
    
    public static function testClass(){
        self::assertClassExists('RaiseTextField');
        self::assertClassExists('RaiseTextField', 'RaiseFormField');
        self::assertClassMethod('RaiseTextField', 'value');
    }

    public static function testUsage(){
        $field = new RaiseTextField('id');
        $field->value('test');
        $field->clientId('txtTest');
        self::assertType($field->output(), 'string');
        $result = RaiseDomParser::parseString($field->output());
        self::assertStrictEqual($result->count(), 1);
        self::assertStrictEqual($result->get(0)->tagName(), 'input');
        self::assertStrictEqual($result->get(0)->attributes()->get('value'), 'test');
        self::assertStrictEqual($result->get(0)->attributes()->get('name'), 'txtTest');
        self::assertStrictEqual($result->get(0)->attributes()->get('id'), 'txtTest');
        self::assertStrictEqual($result->get(0)->attributes()->get('type'), 'text');
    }

}
